package bud.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import lombok.extern.slf4j.Slf4j;

/**
 * Application Lifecycle Listener implementation class MySessionListener
 *
 */
@Slf4j
@WebListener
public class MySessionListener implements HttpSessionListener {
	public static int count;
    /**
     * Default constructor. 
     */
    public MySessionListener() {
        
    }

	/**
     * @see HttpSessionListener#sessionCreated(HttpSessionEvent)
     */
    public void sessionCreated(HttpSessionEvent arg0) {
    	log.info("세션 생성 : " + arg0.getSession().getId());
    	count++;
    }

	/**
     * @see HttpSessionListener#sessionDestroyed(HttpSessionEvent)
     */
    public void sessionDestroyed(HttpSessionEvent arg0) {
    	log.info("세션 스탑 : " + arg0.getSession().getId());
    	count--;
    }
	
}
